package cn.qw.springcache.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.stereotype.Service;


import cn.qw.springcache.pojo.Employee;
import cn.qw.springcache.dao.EmployeeMapper;

@Service
public class EmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;


    public int deleteByPrimaryKey(Integer id) {
        return employeeMapper.deleteByPrimaryKey(id);
    }


    public int insert(Employee record) {
        return employeeMapper.insert(record);
    }


    public int insertSelective(Employee record) {
        return employeeMapper.insertSelective(record);
    }

    @Cacheable(cacheNames = "emp", key = "#id", condition = "#id>0")
    public Employee selectByPrimaryKey(Integer id) {
        return employeeMapper.selectByPrimaryKey(id);
    }


    public int updateByPrimaryKeySelective(Employee record) {

        return employeeMapper.updateByPrimaryKeySelective(record);
    }


    public int updateByPrimaryKey(Employee record) {
        return employeeMapper.updateByPrimaryKey(record);
    }



}
